import React, {Component} from 'react';
import {Flex, WhiteSpace} from 'antd-mobile';
import { Link} from 'react-router-dom';
import { connect } from 'react-redux';

import './bottom.scss'

const place = {
    nowPlace1: '首页',
    nowPlace2: '全屋定制',
    nowPlace3: '全屋定制2',

};

class BottomCon extends Component {

    constructor(props) {
        super(props);
        this.state = {
            place: place
        };
    }



    render() {


        return (
            <div className='bottomCon'>
                <div className='nowP'>
                    <Flex justify='start'>
                        <p className='nowPlace'>

                            当前位置:{this.props.proRoute}

                        </p>
                    </Flex>
                </div>
                <div className='flex-container bottomCt'>
                    <Flex justify="around" className='redict'>
                        <a href="http://www.lbddd.com/">3D木门官网</a>
                        <a href="http://www.lbddd.com/index.php?s=/support.html">招商联盟</a>
                        <Link to='/chatonline'>联系我们</Link>

                    </Flex>
                    <WhiteSpace size="lg"/>
                    <p>©2018 三帝家居有限公司版权所有</p>
                    <p>粤ICP备18004638号</p>
                    <p>京公网安备 11010502033014号</p>
                </div>
            </div>
        )
    }

}

// 将store中的数据作为props绑定到组件中，只要store更新了就会调用mapStateToProps方法
// 返回的结果必须是object对象,作为输入
// 键是该组件的prop属性，值是该prop的值
const mapStateToProps = (state) =>{
    let routename = state.publics.routename;
    let nowPlace = '';
    switch (routename){
        case '/stores' :
            nowPlace = <span><Link to='/tv'>首页</Link>><Link to=''>实体门店</Link></span>;
            break;
        case '/tv' :
            nowPlace = '首页>tv';
            break;
        case '/measurement':
            nowPlace = <span><Link to='/'>首页</Link>><span >预约量尺</span></span>;
            break;
        case '/brandIntroduction':
            nowPlace = <span><Link to='/'>首页</Link>><span >品牌实力</span></span>;
            break;
        case '/classification':
            nowPlace = <span><Link to='/'>首页</Link>><span >分类</span></span>;
            break;
        case '/articles':
            nowPlace = <span><Link to='/'>首页</Link>><span >文章页</span></span>;
            break;
        case '/maindetails':
            nowPlace = <span><Link to='/'>首页</Link>><span >商品详情</span></span>;
            break;
        case '/list':
            nowPlace = <span><Link to='/'>首页</Link>><span >列表页</span></span>;
            break;
        case '/homelist':
            nowPlace = <span><Link to='/'>首页</Link>><span >全屋页</span></span>;
            break;
        case '/baidumap':
            nowPlace = <span><Link to='/'>首页</Link>><span >地图</span></span>;
            break;
        case '/chatonline':
            nowPlace = <span><Link to='/'>首页</Link>><span >地图</span></span>;
            break;
        default :
            nowPlace = '首页';
            break;
    }
    return {
        proRoute : nowPlace
    }

}
// // 返回包含对应action的object对象,作为输出
// // 键是prop的属性名，值是一个redux的dispatch
// // 当这个prop属性被用于触发时，dispatch会改变redux中state的值。
/*const mapDispatchToProps = (dispatch) =>{
    console.log('ff22')
    return null
}*/
// //第一个括号中的参数是用来改变该组件prop的方法，第二个括号是要添加prop的react组件
export default connect(mapStateToProps)(BottomCon)